<?php
namespace app\wechat\home;

use app\common\controller\Wechat;

class Menu extends Wechat
{

	public function create() {
		$wechatOauth = \We::WeChatOauth(config('wechat.'));
		$menu = [
				[
					"name"=> "面料处理",
					"sub_button"=> [
						[
							"type"=> "view",
							"name"=> "验布区",
							"url"=> $wechatOauth->getOauthRedirect(wechatUrl('wechat/CheckclothShrink/checkcloth'), '', 'snsapi_userinfo'),
						],
						[
							"type"=> "view",
							"name"=> "缩水区",
							"url"=> $wechatOauth->getOauthRedirect(wechatUrl('wechat/CheckclothShrink/shrink'), '', 'snsapi_userinfo'),
						],
					]
				],
				[
					"name"=> "裁床车间",
					"sub_button"=> [
						[
							"type"=> "view",
							"name"=> "车间管理",
							"url"=> $wechatOauth->getOauthRedirect(wechatUrl('wechat/workshop/index'), '', 'snsapi_userinfo'),
						],
					]
				],
				[
					"name"=> "任务管理",
					"sub_button"=> [
						[
							"type"=> "view",
							"name"=> "我参与的任务",
							"url"=> $wechatOauth->getOauthRedirect(wechatUrl('wechat/task/myJoin'), '', 'snsapi_userinfo'),
						],
						[
							"type"=> "view",
							"name"=> "我创建的任务",
							"url"=> $wechatOauth->getOauthRedirect(wechatUrl('wechat/task/myCreate'), '', 'snsapi_userinfo'),
						],
					]
				],
		];
		$wechatMenu = \We::WeChatMenu(config('wechat.'));
		$res = $wechatMenu->create(['button' => $menu]);
		print_r($res);
		print_r($menu);
		exit;
	}


}